/*
 * tenvironment.h
 *
 *  Created on: Jan 24, 2016
 *      Author: root
 */

#ifndef FUNNY_SCHEME_ENVIRONMENT_H_
#define FUNNY_SCHEME_ENVIRONMENT_H_

#include "../ds/datastructure.h"

/*
DEFINE_OPERATOR( int_env  );
DEFINE_OPERATOR( curr_env );
INIT_OPERATORS( environment );

// 环境
void new_frame_in_env(Scheme *sc, Cell* oldEnv);
void new_slot_in_env(Scheme *sc, Cell* sym, Cell* value);
Cell* find_slot_in_env(Scheme *sc, Cell* env, Cell* sym, int all);
void set_slot_in_env(Scheme *sc, Cell* symbol, Cell* value);
Cell* slot_value_in_env(Cell* symbol);
*/

// refer to SICP
void extend_environment(Scheme *sc, Cell* frame, Cell* baseEnv);
void add_binding_to_frame(Scheme *sc, Cell* frame, const char* var, Cell* val, int isConstant);
Cell* lookup_variable_value(Scheme *sc, Cell* env, const char* var);
Cell* set_variable_value(Scheme *sc, Cell* env, const char* var, Cell* val);
Cell* define_variable(Scheme *sc, Cell* env, const char* var, Cell* val);
void define_global_constant(Scheme *sc, const char* var, Cell* val);

#endif //FUNNY_SCHEME_ENVIRONMENT_H_
